for p inrange(lp.pipes):
for x inrange(lp.p_size):
print(p,x)
lp.clear(show=False)
lp.set_pixel(p, x, (255,0,0))
lp.show()
time.sleep(0.5)
lp.set_pipe(0, (0,255,0))
lp.show()
lightpipe advanced
more features in the lightpipe core
Position Overflow handling
adjacent: draw overflowing pixels on all adjacent pipes. nyi
border: replace overflowing values with max or min.
discard: ignore overflowing values.
flow: like adjacent, but only either up- or downstream. nyi
modulo: overflow into the same pipe.
next: overflow into the (linear) next pipe.
Overflow code
if mode == "border":
x = max(0, min(x, self.p_size-1))
if mode == "discard":
##passif mode == "modulo":
x = x % self.p_size
if mode == "next":
p += x // self.p_size
x = x % self.p_size
return p,x
Demo Time
Paste multiple colors
lp.fill(p, x, colors, overflow)
for i, color inenumerate(colors):
self.set_pixel(p, x+i, color, overflow)